package nc.ui.budget.tools.pubClass;
import java.awt.Component;

import nc.ui.budget.tools.NCLocator.MyNCLocator;
import nc.ui.budget.tools.pubfun.MyLinkQueryData;
import nc.ui.ml.NCLangRes;
import nc.ui.pub.FuncNodeStarter;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pub.config.NcSession;
import nc.ui.pub.linkoperate.ILinkQueryData;
import nc.ui.sm.login.ClientAssistant;
import nc.ui.sm.power.FuncRegister;
import nc.ui.uap.sf.SFClientUtil;
import nc.vo.sm.funcreg.FuncRegisterVO;
public class OpenNode  extends SFClientUtil{
public OpenNode() {

}
public void OpenByUserObject(String funCode,Object userObject) {
	MyLinkQueryData data=new MyLinkQueryData(userObject);
	 if (funCode != null) {
   	 FuncRegisterVO frVO = findFRVOFromMenuTree(funCode);
        if (frVO == null) {
          frVO = FuncRegister.getFuncRegisterVOByCode(funCode);
        }
     if (frVO != null)
       FuncNodeStarter.openLinkedDialog(frVO, 3, data, null, false, true, null);
     else {
       MessageDialog.showErrorDlg(ClientAssistant.getApplet(), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000062"), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000095") + funCode);
     }
   }
   else
   {
     System.out.println("funcCode is null, can't open funnode");
   }
}


	public void OpenByBillID(String funCode,String BillID) {
		LinkQueryDataBillID data=new LinkQueryDataBillID(BillID);
		 if (funCode != null) {
	    	 FuncRegisterVO frVO = findFRVOFromMenuTree(funCode);
	         if (frVO == null) {
	           frVO = FuncRegister.getFuncRegisterVOByCode(funCode);
	         }
	      if (frVO != null)
	        FuncNodeStarter.openLinkedDialog(frVO, 3, data, null, false, true, null);
	      else {
	        MessageDialog.showErrorDlg(ClientAssistant.getApplet(), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000062"), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000095") + funCode);
	      }
	    }
	    else
	    {
	      System.out.println("funcCode is null, can't open funnode");
	    }
	}
	
	
	
	
	public OpenNode(String funCode,Object userObject) {
		MyLinkQueryData data=new MyLinkQueryData(userObject);
		 if (funCode != null) {
	    	 FuncRegisterVO frVO = findFRVOFromMenuTree(funCode);
	         if (frVO == null) {
	           frVO = FuncRegister.getFuncRegisterVOByCode(funCode);
	         }
	      if (frVO != null)
	        FuncNodeStarter.openLinkedDialog(frVO, 3, data, null, false, true, null);
	      else {
	        MessageDialog.showErrorDlg(ClientAssistant.getApplet(), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000062"), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000095") + funCode);
	      }
	    }
	    else
	    {
	      System.out.println("funcCode is null, can't open funnode");
	    }
	}
	
	
	
	public OpenNode(String funCode, Component parent, Object userobject) {
		NcSession.setAttribute("parent", parent);
		MyLinkQueryData data=new MyLinkQueryData(userobject);
		
		 if (funCode != null) {
	    	 FuncRegisterVO frVO = findFRVOFromMenuTree(funCode);
	         if (frVO == null) {
	           frVO = FuncRegister.getFuncRegisterVOByCode(funCode);
	         }
	      if (frVO != null)
	        FuncNodeStarter.openLinkedDialog(frVO, 3, data, parent, false, true, null);
	      else {
	        MessageDialog.showErrorDlg(ClientAssistant.getApplet(), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000062"), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000095") + funCode);
	      }
	    }
	    else
	    {
	      System.out.println("funcCode is null, can't open funnode");
	    }
	}
	
	
	
	public OpenNode(String funCode, Component parent, ILinkQueryData data) {
		 if (funCode != null) {
	    	 FuncRegisterVO frVO = findFRVOFromMenuTree(funCode);
	         if (frVO == null) {
	           frVO = FuncRegister.getFuncRegisterVOByCode(funCode);
	         }
	      if (frVO != null)
	        FuncNodeStarter.openLinkedDialog(frVO, 3, data, parent, false, true, null);
	      else {
	        MessageDialog.showErrorDlg(ClientAssistant.getApplet(), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000062"), NCLangRes.getInstance().getStrByID("sysframev5", "UPPsysframev5-000095") + funCode);
	      }
	    }
	    else
	    {
	      System.out.println("funcCode is null, can't open funnode");
	    }
	}
}
